﻿@model SubmitReturnRequestModel
@using Nop.Web.Models.Order;
@{
    Layout = "~/Views/Shared/_Layout.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.ReturnItems").Text);
}
<div class="page return-request-page">
    <div class="page-title">
        <h1>@string.Format(T("ReturnRequests.Title").Text, Model.OrderId)</h1>
    </div>
    <div class="clear">
    </div>
    <div class="page-body">
        @if (!String.IsNullOrEmpty(Model.Result))
        {
            <div class="result">
                @Model.Result
            </div>
        }
        else
        {
            using (Html.BeginForm())
            {
                <fieldset class="form-fields products-box">
                    <h2>@T("ReturnRequests.SelectProduct(s)")</h2>
                    <dl>
                        <dd>
                            <table class="data-table">
                                <thead>
                                    <tr>
                                        <th class="a-center">
                                            @T("ReturnRequests.Products.Name")
                                        </th>
                                        <th class="a-center">
                                            @T("ReturnRequests.Products.Price")
                                        </th>
                                        <th class="a-center">
                                            @T("ReturnRequests.Products.Quantity")
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach (var item in Model.Items)
                                    {
                                        <tr>
                                            <td class="a-left">
                                                <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })" title="View details">@item.ProductName</a>
                                                @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                                {
                                                    <div class="attributes">
                                                        @Html.Raw(item.AttributeInfo)
                                                    </div>
                                                }
                                            </td>
                                            <td class="a-left">
                                                @item.UnitPrice
                                            </td>
                                            <td class="a-left">
                                                <select name="quantity@(item.Id)">
                                                    @for (int i = 0; i <= item.Quantity; i++)
                                                    {
                                                        <option value="@(i)">@(i)</option>
                                                    }
                                                </select>
                                            </td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        </dd>
                    </dl>
                </fieldset>
                <fieldset class="form-fields why">
                    <h2>@T("ReturnRequests.WhyReturning")</h2>
                    <dl>
                        <dt>
                            @Html.LabelFor(model => model.ReturnReason)
                        </dt>
                        <dd>
                            @Html.DropDownListFor(model => model.ReturnReason, Model.AvailableReturnReasons, new { @class = "return-reasons" })
                        </dd>
                        <dt>
                            @Html.LabelFor(model => model.ReturnAction)
                        </dt>
                        <dd>
                            @Html.DropDownListFor(model => model.ReturnAction, Model.AvailableReturnActions, new { @class = "return-actions" })
                        </dd>
                        <dt>
                            @Html.LabelFor(model => model.Comments)
                        </dt>
                        <dd>
                            @Html.TextAreaFor(model => model.Comments, new { @class = "comment" })
                            @Html.ValidationMessageFor(model => model.Comments)
                        </dd>


                    </dl>
                    <table>
                        <tr>
                            Shipping Method:
                        </tr>
                        @foreach (var method in Model.ShipmentMethods)
                        {
                            <tr>
                                <td>
                                    @Html.RadioButton("ShipmentMethodId", method.Value, method.Selected)
                                    <label class="forcheckbox" for=@method.Value>
                                        @method.Text

                                    </label>
                                </td>
                            </tr>
                        }
                    </table>
                </fieldset>
                <div class="clear">
                </div>
                <div class="buttons">
                    <input type="submit" name="submit-return-request" class="button-1 button-red submit-return-request-button" value="@T("ReturnRequests.Submit")" />
                </div>
            }
        }
    </div>
</div>
